<!DOCTYPE html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <title>{BEESCRM:$theme_name}</title>
    <meta name="description" content="">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui, user-scalable=no">
    <meta http-equiv="cleartype" content="on">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="/assets/base/user/default/css/index.css">
    <link rel="stylesheet" href="/assets/public/defaultalert/css/default_alert.css">
    <link rel="stylesheet" href="/assets/base/repair/js/sweetalert/lib/sweet-alert.css">
</head>
<body>
<!--温州大学一卡通绑定-->
<div class="wraper">
    <div class="header bg-green">
        <p class="iconfont icon-iconfontuniversity"></p>
        <p>一卡通绑定</p>
        <a href="javascript:history.back(-1)" class="back"><img src="/assets/base/center/images/return.png"/></a>
    </div>
    <div class="container">
        <div class="form-list margin-b clearfix">
            <span class="field pull-left" style="width:28%">一卡通学工号</span>
            <input class="form-control pull-left" placeholder="请输入您的卡号" id="number" value="" style="width:70%"/>
            <p class="tips-icon">
                <span class="iconfont icon-zhengque icon-green" id="right"></span>
                <span class="iconfont icon-cuowu icon-red" id="wrong"></span>
            </p>
        </div>
        <div class="form-list margin-b clearfix">
            <span class="field pull-left" style="width:28%">一卡通密码</span>
            <input class="form-control pull-left" placeholder="请输入您的一卡通密码" id="password" value="" style="width:70%"/>
            <p class="tips-icon">
                <span class="iconfont icon-zhengque icon-green" id="right"></span>
                <span class="iconfont icon-cuowu icon-red" id="wrong"></span>
            </p>
        </div>
        <p class="tips validation-tips margin-b"></p>
        <div class="btn-box margin-b">
            <a href="javascript:void(0);" class="btn register">提交</a>
        </div>

    </div>
	<input type="hidden" id="type" value="0">
    <div class="bottom-box">
        <p class="copyright">杭州青橄榄网络技术有限公司 技术支持</p>
    </div>
</div>
<script src="/assets/base/repair/js/jquery-2.1.0.min.js"></script>
<script src="/assets/base/repair/js/sweetalert/lib/sweet-alert.min.js"></script>
<script src="/assets/base/repair/js/jq.utils.js"></script>
<script src="/assets/public/defaultalert/js/default_alert.js"></script>
<script>
    $(window).load(function(){
        $('.load').hide();
    });
</script>
<script type="text/javascript">
	// 学号验证
	$('#number').bind('input propertychage',function(){
		var number = $(this).val();
		if(number.length < 6){
			notice('#number', 'wrong');
			return false;
		}
	});

    // 点击获取验证码
    var verifyTag = true;
    $('.form-list').on('click', '#btn_verify', function (e) {
        e.preventDefault();
        if(verifyTag) getCode('#btn_verify');
        else return;
    }); 

    var height = $(window).height();
    var bottombox_height = $('.bottom-box').outerHeight();
    $('.wraper').css("minHeight", height);
    $('.wraper').css("paddingBottom", bottombox_height);

	// 验证提示
	function notice(elem, class_name){
		$(elem).siblings().find('.iconfont').hide();
		$(elem).siblings().find('#' + class_name).show();
	}

	$(document).on('click','.register',function(){
		var data = {};
		data.number = $('#number').val();
		data.password = $('#password').val();
        
		if (!data.number) {
            $('.validation-tips').html('请输入正确的学工号').show();
			return false;
		}
        var preg = /^\d{6}\w?$/;
        if(!data.password){
            $('.validation-tips').html('请输入一卡通密码').show();
            return false;
        } 

        if(!preg.test(data.password)){
            $('.validation-tips').html('请输入正确的一卡通密码').show();
            return false;
        }

		var json = {};
		json.method = 'post';
		json.type = 'json';
		json.url = "{BEESCRM::U('/charger/chargingproxWd/ajaxRegister',array('chargingId'=>$chargingId ,'accountId' => $accountId))}";
		json.data = data;
		$.getAjax(json, true, reload, '');
		
	});
	function reload(data){
        //console.log(data)
		location.href="{BEESCRM::U('/charger/chargingproxWd/charge',array('accountId'=>$accountId,'chargingId'=>$chargingId,'terminalId'=>$terminalId))}";
	}
</script>
</body>
</html>